//
//  UIBarButtonItem+Button.swift
//  Weibo Demo
//
//  Created by 朴裕识 on 15/12/20.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
//    直接重写构造方法
//    (imageName: "timeline_icon_retweet", fontSize: 11, title: "转发")
    convenience init(imageName: String) {
        let button = UIButton()
        button.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        button.sizeToFit()
        self.init(customView: button)
    }
    
    
    
    class func creatBarButton(imageName: String) -> UIBarButtonItem {
        let button = UIButton()
        button.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        button.sizeToFit()
        return UIBarButtonItem(customView: button)
    }
    
    
    
    
    
}







